Skip to content

Show LaTeX math expressions in haddockToMarkdown #4658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

webdevred
Copy link

  • Replace fallback messages with raw LaTeX math expressions using $...$ and $$...$$.
  • This lets editors display the original math content even if they don't render LaTeX.
  • No sanitization is performed, raw LaTeX is output as-is.
  • Related to Documentation popup: \mathcal not resolved/formatted? #201

@webdevred webdevred requested a review from wz1000 as a code owner July 13, 2025 09:50
@webdevred webdevred force-pushed the support-math-expressions branch from 73c076b to b6bc7b8 Compare July 13, 2025 09:51
- Replace fallback messages with raw LaTeX math expressions using $...$ and $$...$$.
- This lets editors display the original math content even if they don't render LaTeX.
- No sanitization is performed, raw LaTeX is output as-is.
@webdevred webdevred force-pushed the support-math-expressions branch from b6bc7b8 to 74a72ae Compare July 14, 2025 14:18
Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@fendor fendor requested a review from michaelpj July 14, 2025 14:38
@fendor fendor added the status: needs review This PR is ready for review label Jul 14, 2025
@michaelpj
Copy link
Collaborator

Should we be putting these inside a code formatting? They are, if anything, code, and I think it will read less weirdly if it's formatted that way? or are we hoping that some markdown renderers might actually try to render the latex?

@webdevred
Copy link
Author

webdevred commented Jul 14, 2025

@michaelpj Makes sense. I can update the patch to use code formatting instead if that’s preferred.

Edit:
Quick question, if we don’t go with $...$ or $$...$$ for math formatting, should we use plain backticks (`...`) for DocMathInline, or would it make sense to use fenced code with a latex language tag even for inline math content?

The idea behind using a latex tag or math-style blocks is to make it clearer that it’s LaTeX content. I know fenced blocks are unconventional for inline content, but I wanted to ask before finalizing.

Either way, this change is something I will really appreciate since it means I won’t have to open the documentation in a browser to see important details such as time complexity, all the important information will be in my text editor.

@michaelpj
Copy link
Collaborator

I think it probably makes sense to use inline-code-formatting (single backticks) for inline math, and a fenced code block (triple backticks) for display math? so that would mean we could only include the language tag for display math, but that's a downside that all users of markdown face I guess.

@webdevred
Copy link
Author

I updated the patch to use single backticks for inline math and fenced code blocks with the latex tag for display math, as discussed.

@michaelpj michaelpj added the merge me Label to trigger pull request merge label Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Label to trigger pull request merge status: needs review This PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants